/**
 * Create by yxk at 2020/6/11
 */
import request from '@/utils/request'

/**
 * 采购退货单新建/编辑
 */
export function jxcRetreatAddOrUpdateAPI(data, isUpdate = false) {
  return request({
    url: 'jxcRetreat/addOrUpdate' + (isUpdate ? '/update' : '/add'),
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/**
 * 采购退货单详情
 */
export function jxcRetreatQueryByIdAPI(data) {
  return request({
    url: `jxcRetreat/queryById/${data.label}`,
    method: 'post',
    data: data
  })
}

/**
 * 采购退货单删除
 */
export function jxcRetreatDeleteByIdsAPI(data) {
  return request({
    url: 'jxcRetreat/deleteByIds',
    method: 'post',
    data: data
  })
}

/**
 * 编辑时查询采购退货单关联产品
 */
export function jxcRetreatQueryEdProductListAPI(data) {
  return request({
    url: 'jxcRetreatProduct/queryEdRetreatProductList',
    method: 'post',
    data: data
  })
}

/**
 * 编辑时查询采购退货单关联产品
 */
export function jxcRetreatQueryProductListAPI(data) {
  return request({
    url: 'jxcRetreatProduct/queryRetreatProductList',
    method: 'post',
    data: data
  })
}

/**
 * 采购退货出库记录
 */
export function jxcRetreatQueryRecordAPI(data) {
  return request({
    url: 'jxcRetreat/queryRecord',
    method: 'post',
    data: data
  })
}

/**
 * 采购退货作废
 */
export function jxcRetreatSetStateByIdsAPI(data) {
  return request({
    url: 'jxcRetreat/setStateByIds',
    method: 'post',
    data: data
  })
}
